﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Stile.NUnit;
using Stile.Patterns.SelfDescribingPredicates;
using Stile.Patterns.SelfDescribingPredicates.Evaluators;
#endregion

namespace Stile.Tests.Patterns.SelfDescribingPredicates
{
    [TestFixture]
    public class ExpectFixture : SampleFixture
    {
        [Test]
        public void CountOf()
        {
            Assert.That(_sample.IntEnumerable.Count(), Is.EqualTo(0));

            // arrange
            Evaluator<IEnumerable<int>, int> evaluator = ExpectEnumerable<IEnumerable<int>, int>.CountOf(1);

            // act
            IEvaluation<IEnumerable<int>> evaluation = evaluator.Evaluate(_sample.IntEnumerable);

            // assert
            Assert.That(evaluation.Success, Is.False);
            Assert.That(evaluation.Reason,
                Is.EqualTo("would have count of 1" + Environment.NewLine + " but had count of 0"));
        }
    }
}
